<template>
  <div class="dashboard-container">
    <!-- 协议主体 -->
    <div class="agreement">
      <div class="agreement-title">
        <span>协议主体</span>
      </div>
      <div class="agreement-from">
        <div class="agreement-content">
          <el-row>
            <el-form :inline="true" :model="formInline" class="demo-form-inline">
              <el-col :span="12">
                <el-form-item label="协议客户">
                  <el-input v-model="formInline.user" placeholder="协议客户"></el-input>
                  <span>上海正也医药有限公司</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="协议状态">
                  <el-select v-model="formInline.state" placeholder="协议状态">
                    <el-option label="正常" value="0"></el-option>
                    <el-option label="异常" value="1"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="购进指标">
                  <el-select v-model="formInline.target" placeholder="购进指标">
                    <el-option label="金额" value="0"></el-option>
                  </el-select>
                  <input type="text" disabled placeholder="输入金额/数量" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="纯销指标">
                  <el-select v-model="formInline.pin" placeholder="购进指标">
                    <el-option label="金额" value="0"></el-option>
                  </el-select>
                  <input type="text" disabled placeholder="输入金额/数量" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="选择区域">
                  <el-input v-model="formInline.user" placeholder="选择区域"></el-input>
                  <span>全国</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="签订时间">
                  <el-input v-model="formInline.user" placeholder="选择区域"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="购进渠道">
                  <el-select v-model="formInline.channel" placeholder="购进渠道">
                    <el-option label="指定渠道" value="0"></el-option>
                  </el-select>
                  <input type="text" placeholder="请选择渠道" />
                </el-form-item>
              </el-col>
            </el-form>
          </el-row>
          <el-row>
            <el-table
              :data="tableData"
              style="width: 100%"
              :header-cell-style="{background:'#f0f0f0'}"
            >
              <el-table-column prop="number" label="指定渠道编码"></el-table-column>
              <el-table-column prop="name" label="指定渠道名称"></el-table-column>
              <el-table-column prop="address" label="所在省"></el-table-column>
            </el-table>
          </el-row>
        </div>
      </div>
    </div>
    <!-- 产品政策 -->
    <div>
      <div class="product-title">
        <span>产品政策</span>
      </div>
      <div class="product-policy">
        <div>
          <el-button type="primary">添加产品</el-button>
        </div>
        <div>
          <span>购进总指标(万元)：</span>
          <span>￥152.65</span>
        </div>
        <div>
          <span>指标按季度分解(万元)：</span>
          <span>【Q1】￥12.5,【Q2】￥12.5,【Q3】￥12.5,【Q4】￥12.5</span>
        </div>
        <div>
          <span>纯销总指标(万元)：</span>
          <span>￥152.65</span>
        </div>
      </div>
      <div class="product-content">
        <div class="product-form">
          <el-form :inline="true" :model="formInline" class="demo-form-inline">
            <el-form-item label="产品：">
              <el-select v-model="formInline.region" placeholder="选择产品">
                <el-option label="美复胶丸" value="美复胶丸"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="协议效期：">
              <el-date-picker
                v-model="value1"
                type="daterange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-form>
          <el-table :data="productData" style="width: 100%">
            <el-table-column label="协议价(元)"></el-table-column>
            <el-table-column label="票折(元)"></el-table-column>
            <el-table-column label="购进指标量(大单位)"></el-table-column>
            <el-table-column label="购进指标量(小单位)"></el-table-column>
            <el-table-column label="购进金额(万元)"></el-table-column>
            <el-table-column label="纯销指标量(小单位)"></el-table-column>
            <el-table-column label="纯销指标金额(万元)"></el-table-column>
          </el-table>
        </div>
      </div>
    </div>
    <!-- 补充协议 -->
    <div>
      <div class="sup-title">
        <span>补充协议</span>
      </div>
      <div class="sup-agreement">
        <el-tabs class="sup-tabs" v-model="activeName" type="card" @tab-click="handleClick">
          <el-tab-pane label="补充协议1" name="first">
            <div>
              <span>协议内容：</span>
            </div>
            <div>
              <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="textarea"></el-input>
            </div>
          </el-tab-pane>
          <el-tab-pane label="补充协议2" name="second">
            <div>
              <span>协议内容：</span>
            </div>
            <div>
              <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="textarea"></el-input>
            </div>
          </el-tab-pane>
          <el-tab-pane label="补充协议3" name="third">
            <div>
              <span>协议内容：</span>
            </div>
            <div>
              <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="textarea"></el-input>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  name: "Dashboard",
  data() {
    return {
      formInline: {
        user: "",
        state: "0",
        target: "0",
        pin: "0",
        channel: "0"
      },
      tableData: [
        {
          number: "BJ000090",
          name: "宁波九州通药业有限公司",
          address: "浙江省"
        },
        {
          number: "BJ000192",
          name: "国药控股精华有限公司",
          address: "浙江省"
        },
        {
          number: "BJ000283",
          name: "老百姓药业有限公司",
          address: "浙江省"
        }
      ],
      activeName: "first",
      textarea: "",
      productData: []
    };
  },
  computed: {
    ...mapGetters(["name"])
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    }
  }
};
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
.agreement-from,
.product-content,
.sup-agreement {
  background-color: #fff;
  border-radius: 4px;
}
.el-input {
  width: auto;
}
.product-policy {
  display: flex;
  align-items: center;
  padding-bottom: 12px;
}
.agreement-title,
.product-title,
.sup-title {
  display: flex;
  justify-content: center;
  padding: 10px;
}
.agreement-content,
.product-form {
  padding: 20px;
}
::v-deep .el-input__inner {
  width: 150px;
}
.sup-tabs {
  padding: 12px;
}
</style>
